package com.design.decorate;

/**
 * 前置装饰类
 *
 * @author cxx
 * @create 2020-04-20 15:42
 **/
public class BeforeDecorator implements Decorator {

    /**
     * 前置词
     */
    private String beforeWords;

    private Decorator decorator;

    public BeforeDecorator(String beforeWords,Decorator decorator) {
        this.decorator = decorator;
        this.beforeWords = beforeWords;
    }

    @Override
    public String describe(String name) {
        name = beforeWords + name;
        return decorator.describe (name);
    }

}
